# -*- mode: dockerfile -*-

FROM nvidia/cuda:11.4.3-devel-ubuntu20.04

ARG PYTHON_VERSION=3.8
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub

RUN apt-get update && apt-get install -yq \
        bison \
        build-essential \
        cmake \
        curl \
        flex \
        git \
        libbz2-dev \
        ninja-build \
        wget

WORKDIR /opt/conda_setup

RUN curl -o miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && \
     chmod +x miniconda.sh && \
     ./miniconda.sh -b -p /opt/conda && \
     /opt/conda/bin/conda install -y python=$PYTHON_VERSION && \
     /opt/conda/bin/conda clean -ya
ENV PATH /opt/conda/bin:$PATH

RUN python -m pip install --upgrade pip ipython ipdb

COPY . /opt/nle/

WORKDIR /opt/nle

RUN pip install '.[all]'

WORKDIR /workspace

CMD ["/bin/bash"]


# Docker commands:
#   docker rm nle -v
#   docker build -t nle -f docker/Dockerfile-focal .
#   docker run --gpus all --rm --name nle nle
# or
#   docker run --gpus all -it --entrypoint /bin/bash nle
